<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>vue中的js动画与velocity</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
				<transition name="fade"
				@before-enter="handleBeforeEnter"
				@enter="handleEnter"
				@after-enter="handleAfterEnter">
					<div v-show="show">
						<h1>hello world</h1>
					</div>
				</transition>
				<button type="button" @click="handleClick">toggle</button>
		</div>
		<script type="text/javascript">
			var vm = new Vue({
				el:"#app",
				data:{
					show:true
				},
				methods:{
					handleClick:function(){
						this.show = !this.show;
					},
					handleBeforeEnter:function(el){
						el.style.color = 'red'
					},
					handleEnter:function(el,done){
						setTimeout(()=>{
							el.style.color ='green'
							done()
						},2000)
					},
					handleAfterEnter:function(el,done){
						setTimeout(function()
						{el.style.color = '#000'
							done()}
							,2000)
					}
				}
			});
		</script>
	</body>
</html>
